/*
格式化时间
format :"yyyy-mm-dd hh:ii:ss";

	return 2015-11-05 17:39:23
format :"yyyy-mm-dd";

		return 2015-11-05
format :"yyyy/mm/dd hh/ii/ss";

		return 2015/11/05 17/39/23
format :"yyyy/mm/dd";

	return 2015/11/05

 */
function getDateStrFormate(formart, newDate) {
	var dateSty = arguments[0].split(' '),
			separatorFirst = '',
			separatorSecond = '',
			realDate = '';
	var yyyy = newDate.getFullYear(),
			mm = newDate.getMonth() + 1,
			dd = newDate.getDate(),
			hh = newDate.getHours(),
			ii = newDate.getMinutes(),
			ss = newDate.getSeconds();
	mm = mm < 10 ? '0' + mm : mm;
	dd = dd < 10 ? '0' + dd : dd;
	hh = hh < 10 ? '0' + hh : hh;
	ii = ii < 10 ? '0' + ii : ii;
	ss = ss < 10 ? '0' + ss : ss;

	if (dateSty.length > 1) {
			separatorFirst = dateSty[0].charAt(4);
			separatorSecond = dateSty[1].charAt(2);
			realDate = yyyy + separatorFirst + mm + separatorFirst + dd + ' ' + hh + separatorSecond + ii + separatorSecond + ss;
	} else {
			separatorFirst = dateSty[0].charAt(4);
			realDate = yyyy + separatorFirst + mm + separatorFirst + dd;
	}

	return realDate;
}

/* 传入时间对象，返回01～12字符串 */
function getFullMonth(adate) {
	var mstr = ''
	var oldmonth = adate.getMonth() + 1 
	if (oldmonth < 10) {
		mstr +=  '0' + oldmonth
	} else {
		mstr +=  '' + oldmonth
	}

	return mstr
}

export {
	getDateStrFormate,
	getFullMonth
}